﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class BackGround_AdminAdd : System.Web.UI.Page
{
    Operation operation = new Operation();　//声明业务类
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Admin"] == null)
        {
            WebMessageBox.Show("会话失效，请重新登录！");
        }
    }
    protected void btOK_Click(object sender, EventArgs e)
    {
        if (operation.Logon(name.Text.Trim()).Tables[0].Rows.Count <= 0)
        {
            operation.InsertPower(name.Text.Trim(), password.Text.Trim());
            WebMessageBox.Show("添加成功！", "AdminManager.aspx");
        }
        else
        {
            WebMessageBox.Show("添加失败！账号已存在");
        }
    }
}
